package com.boang.fz;

/*
  @author: 13813
  @date: 2024/11/18 11:29
*/
public class Student {
    public String name;
    /*
       私有：只能在本类中访问
       提供get,set方法
     */
    private int age;

    String sex;

    protected double score;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age >= 1 && age <= 120) {
            this.age = age;
        } else {
            System.out.println("无效的年龄");
        }
    }

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
